package ltd.hxya.novel.book.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ltd.hxya.novel.book.entity.BookIndex;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 小说目录表 Mapper 接口
 * </p>
 *
 * @author hxya
 * @since 2022-09-13
 */
public interface BookIndexMapper extends BaseMapper<BookIndex> {

    void deleteByBookId(@Param("ids") List<String> ids);

    List<Integer> isRepeat(@Param("indexNumList") List<Integer> indexNumList,@Param("bookId") String bookId);

    List<BookIndex> getIdAndNum(@Param("bookId") String bookId);

    void updateIndexNum(@Param("bookIndices") List<BookIndex> bookIndices);

    @Select("select max(index_num) from book_index where book_id=#{bookId}")
    Integer getMaxNum(@Param("bookId") String bookId);
}
